<template>
    <div class="statistics-list">
        <div class="statistics-list-item">
            <div class="statistics-list-title">{{ $t('components.whiteListData.63d2q8xad240') }}</div>
            <div class="statistics-list-info">
                <div class="img-left"></div>
                <div class="img-right">
                    <div class="img-right-top">
                        <div class="img-right-top-right">
                            <div class="img-title"><img
                                    src="@/assets/images/white-wanzhou-spect.png"><span>{{ $t('components.whiteListData.63d2q8xae6k0') }}</span>
                            </div>
                            <div class="img-data">124</div>
                        </div>
                    </div>
                    <div class="img-right-bottom">
                        <div class="img-right-bottom-right">
                            <div class="img-title"><img
                                    src="@/assets/images/white-wanzhou-operator.png"><span>{{ $t('components.whiteListData.63d2q8xae9s0') }}</span>
                            </div>
                            <div class="img-data">124</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="statistics-list-item">
            <div class="statistics-list-title">{{ $t('components.whiteListData.63d2q8xaec00') }}</div>
            <div class="device-menu">
                <div class="device-menu-title">
                    <div class="device">{{ $t('components.whiteListData.63d2q8xaeds0') }}</div>
                    <div class="name">{{ $t('components.whiteListData.63d2q8xaefs0') }}</div>
                </div>
                <div class="info wrap">
                    <ul class="device-signal-scroll device-signal-border">
                        <li class="signal" v-for="(item, index) in (form.list as any)" :key="index">
                            <div class="model">
                                <div class="model-info">
                                    <div class="img img1">
                                        <img src="@/assets/images/white-wanzhou-spect.png">
                                    </div>
                                    <div>{{ useIdModelFormat(item.uavId).name }}</div>
                                </div>
                            </div>
                            <div class="name">
                                <div class="name-info">
                                    <div class="img img1">
                                        <img src="@/assets/images/white-wanzhou-operator.png">
                                    </div>
                                    <div>{{ item.customerName }}</div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="statistics-list-item">
            <div class="statistics-list-title">{{ $t('components.whiteListData.63d2q8xaei00') }}</div>
            <div class="device-menu">
                <div class="device-menu-title">
                    <div class="device">{{ $t('components.whiteListData.63d2q8xaeds0') }}</div>
                    <div class="name">{{ $t('components.whiteListData.63d2q8xaefs0') }}</div>
                </div>
                <div class="info wrap">
                    <ul class="device-signal-scroll device-signal-border">
                        <li class="signal" v-for="(item, index) in (form.reportList as any)" :key="index">
                            <div class="model">
                                <div class="model-info">
                                    <div class="img img1">
                                        <img src="@/assets/images/white-wanzhou-spect.png">
                                    </div>
                                    <div>{{ item.uavId ? useIdModelFormat(item.uavId).name : '-' }}</div>
                                </div>
                            </div>
                            <div class="name">
                                <div class="name-info">
                                    <div class="img img1">
                                        <img src="@/assets/images/white-wanzhou-operator.png">
                                    </div>
                                    <div>{{ item.customerName ? item.customerName : '-' }}</div>
                                </div>
                            </div>
                        </li>
                        <cNone v-if="!form.reportList?.length"></cNone>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { apiWhiteListList, apiReportList } from '@/api/visual'
import { useIdModelFormat } from "@/hooks/comparison";
const local = useLocal()
const form = reactive({
    data: {
        page: 1,
        pageSize: 10,
        sort: '',
        uavId: '',
        uid: local.usermsg.id == 3 ? 0 : local.usermsg.id
    },
    loading: false,
    list: [],
    reportList: [],
    count: 0
})
// 白名单列表
const getData = async () => {
    form.loading = true
    const { code, data } = await apiWhiteListList({
        ...form.data
    })
    form.loading = false
    if (code != 200) return;
    form.list = data.list
    form.count = data.total
}
// 飞手报备列表
const getReportData = async () => {
    form.loading = true
    const { code, data } = await apiReportList({
        ...form.data
    })
    form.loading = false
    if (code != 200) return;
    form.reportList = data.reportList
    form.count = data.total
}
let timer: any
onBeforeMount(async () => {
    await getData()
    getReportData()
    timer = setInterval(() => {
        getData()
        getReportData()
    }, 3600000)
})
onBeforeUnmount(() => {
    clearInterval(timer)
    timer = null
})
</script>

<style lang="less" scoped>
.statistics-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 16px;
    width: 100%;
    // height: 300px;
    color: var(--color-text-1);

    >.statistics-list-item {
        text-align: center;
        list-style-type: none;
        display: flex;
        flex-direction: column;
        padding-left: 30px;
        align-items: left;
        justify-content: center;
        background-color: var(--data-bg-color);
        border: 1px solid var(--data-border-color);
        border-radius: 5px;

        >.statistics-list-title {
            font-size: 24px;
            font-weight: 700;
            letter-spacing: 0px;
            line-height: 34.75px;
            color: var(--color-text-1);
            text-align: left;
            margin-top: 20px;
            margin-bottom: 20px;
        }

        >.statistics-list-info {
            display: flex;
            align-items: center;
            justify-content: center;

            >.img-left {
                width: 18px;
                height: 250px;
                background-image: url('@/assets/images/white-wanzhou-find1.png');
                background-size: 100% 100%;
                background-repeat: no-repeat;
                background-position: center;
                display: flex;
                justify-content: center;
                align-items: center;
            }

            >.img-right {
                margin-left: -15px;

                >.img-right-top {
                    display: flex;
                    align-items: center;


                    >.img-right-top-right {
                        width: 330.2px;
                        height: 74px;
                        background-image: url('@/assets/images/white-wanzhou-find3.png');
                        background-size: 100% 100%;
                        background-repeat: no-repeat;
                        background-position: center;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        margin-bottom: 30px;

                        >.img-title {
                            margin-left: 60px;
                            display: flex;
                            align-items: center;

                            img {
                                width: 30px;
                                height: 30px;
                                margin-right: 20px;
                            }
                        }

                        >.img-data {
                            width: 100px;
                            text-align: right;
                        }
                    }
                }

                >.img-right-bottom {
                    display: flex;
                    align-items: center;

                    >.img-right-bottom-right {
                        width: 330.2px;
                        height: 74px;
                        background-image: url('@/assets/images/white-wanzhou-find3.png');
                        background-size: 100% 100%;
                        background-repeat: no-repeat;
                        background-position: center;
                        display: flex;
                        justify-content: center;
                        align-items: center;

                        >.img-title {
                            margin-left: 60px;
                            display: flex;
                            align-items: center;

                            img {
                                width: 30px;
                                height: 30px;
                                margin-right: 20px;
                            }
                        }

                        >.img-data {
                            width: 100px;
                            text-align: right;
                        }
                    }
                }
            }

            >.img {
                width: 62px;
                height: 62px;
                border-radius: 50%;
                margin-right: 15px;
                display: flex;
                align-items: center;
                justify-content: center;

                >img {
                    width: 20px;
                    height: 20px;
                }
            }

            >.img1,
            .img4 {
                background-image: radial-gradient(rgba(115, 159, 255, .4), rgba(115, 159, 255, .2), rgba(115, 159, 255, 0.01));
            }

            >.img2,
            .img5 {
                background-image: radial-gradient(rgba(0, 235, 43, .4), rgba(0, 235, 43, .2), rgba(0, 235, 43, 0.01));
            }

            >.img3,
            .img6 {
                background-image: radial-gradient(rgba(255, 234, 77, .4), rgba(255, 234, 77, .2), rgba(255, 234, 77, 0.01));
            }

            >.info {
                height: 70px;
                text-align: left;
            }
        }

        >.device-menu {
            color: var(--color-text-1);
            margin: 10px 0;

            >.device-menu-title {
                display: flex;
                margin-bottom: 20px;

                >div {
                    width: 50%;
                    display: flex;
                    align-items: center;
                    justify-content: left;
                    padding-left: 60px;
                }
            }

            >.info {
                height: 200px;

                >.info-title {
                    padding: 10px 10px 0 10px;
                    font-weight: 500;
                }

                >.status {
                    display: flex;
                    align-items: center;
                    justify-content: right;
                    width: 100%;

                    >.device-status {
                        width: 50%;
                        height: 50px;
                        margin-right: 20px;
                        display: flex;
                        align-items: center;
                        justify-content: space-around;

                        >div {
                            display: flex;
                            align-items: center;
                        }

                        >.online {
                            >.color {
                                background: rgba(36, 189, 255, 1);
                                transform: rotate(-45deg);
                            }
                        }

                        >.offline {
                            >.color {
                                background: rgba(181, 181, 181, 1);
                                transform: rotate(-45deg);
                            }
                        }

                        >.threat {
                            >.color {
                                background: rgba(255, 20, 20, 1);
                                transform: rotate(-45deg);
                            }
                        }

                        .color {
                            width: 5px;
                            height: 5px;
                            transform: rotate(90deg);
                            margin-right: 6px;
                        }
                    }
                }

                >.device-signal-scroll {
                    display: flex;
                    align-items: center;
                    // justify-content: space-around;
                    flex-wrap: wrap;
                    flex: 1;
                    overflow: auto;

                    >.signal {
                        text-align: center;
                        width: 100%;
                        margin: 10px 0;
                        list-style-type: none;
                        position: relative;
                        display: flex;

                        >div {
                            font-size: 13px;
                            font-weight: 500;
                            letter-spacing: 0px;
                            line-height: 17.38px;
                            text-align: left;
                            vertical-align: top;
                            display: flex;
                            justify-content: center;
                            width: 50%;

                            // .img-bg {
                            //     width: 18px;
                            //     height: 18px;
                            //     background-size: cover;
                            //     background-repeat: no-repeat;
                            //     background-position: center;
                            //     display: flex;
                            //     justify-content: center;
                            //     align-items: center;
                            //     margin-right: 5px;
                            // }

                            // .img-bg1 {
                            //     background-image: url('@/assets/images/white-wanzhou1.png');
                            // }

                            // .img-bg2 {
                            //     background-image: url('@/assets/images/white-wanzhou2.png');
                            // }
                        }

                        .model {
                            margin-bottom: 8px;

                            .model-info {
                                width: 150px;
                                display: flex;
                                align-items: center;

                                >.img {
                                    width: 34px;
                                    height: 34px;
                                    border-radius: 50%;
                                    margin-right: 15px;
                                    display: flex;
                                    align-items: center;
                                    justify-content: center;

                                    >img {
                                        width: 16px;
                                        height: 16px;
                                    }
                                }

                                >.img1,
                                .img4 {
                                    background-image: radial-gradient(rgba(115, 159, 255, .4), rgba(115, 159, 255, .2), rgba(115, 159, 255, 0.01));
                                }

                                >.img2,
                                .img5 {
                                    background-image: radial-gradient(rgba(0, 235, 43, .4), rgba(0, 235, 43, .2), rgba(0, 235, 43, 0.01));
                                }

                                >.img3,
                                .img6 {
                                    background-image: radial-gradient(rgba(255, 234, 77, .4), rgba(255, 234, 77, .2), rgba(255, 234, 77, 0.01));
                                }
                            }
                        }

                        .name {
                            margin-bottom: 8px;

                            .name-info {
                                width: 120px;
                                display: flex;
                                align-items: center;

                                >.img {
                                    width: 34px;
                                    height: 34px;
                                    border-radius: 50%;
                                    margin-right: 15px;
                                    display: flex;
                                    align-items: center;
                                    justify-content: center;

                                    >img {
                                        width: 16px;
                                        height: 16px;
                                    }
                                }

                                >.img1,
                                .img4 {
                                    background-image: radial-gradient(rgba(115, 159, 255, .4), rgba(115, 159, 255, .2), rgba(115, 159, 255, 0.01));
                                }

                                >.img2,
                                .img5 {
                                    background-image: radial-gradient(rgba(0, 235, 43, .4), rgba(0, 235, 43, .2), rgba(0, 235, 43, 0.01));
                                }

                                >.img3,
                                .img6 {
                                    background-image: radial-gradient(rgba(255, 234, 77, .4), rgba(255, 234, 77, .2), rgba(255, 234, 77, 0.01));
                                }
                            }
                        }

                    }
                }
            }
        }
    }
}
</style>